<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = 'wdmwfmqwfnqwfn12324';
        //1、长度
        var len = arr.length;
        console.log(len);
        //2、取出指定位置的字符
        var pos1 = prompt("请输入：");
        console.log(arr[pos1]);
        //3、查找指定字符是否存在
        var pos2 = prompt("请输入：");
        var c = 0;
        for(i = 0;i < len; i++){
            if (arr[i] == pos2) {
                console.log("存在");
                c = 1;
                break;
            }
        }
        if (c == 0)console.log("不存在");
        //4、替换指定的字符,如：s换成a
        for(i = 0;i < len; i++){
            if (arr[i] == s)arr[i] = a;
        }
        //5、截取指定位置到结束位置的字符串,如:3,7
        arr = "wdmwfmqwfnqwfn12324";
        var newarr = [];
        for(i = 3;i < 8; i++){
            newarr[newarr.length] = arr[i];
        }
        console.log(newarr);
        //6、出现最多的字符
        var o = {};
       var arr = 'alkdmwlkfkfwmqf';
       for(var i=0;i<arr.length;i++){
        var char = arr.charAt(i);
        if(o[char]){
            o[char]++;
        }
        else{
            o[char] = 1 ;
        }
       }
       console.log(o);
        console.log(max);
        //7、两头加@
        str = '@';
        for (i = 0;i < len; i++) {
           str += arr[i];
        }
        str += '@';
        console.log(str);
    </script>
</head>
<body>
    
</body>
</html>